﻿<%@ Page Title="" Language="C#" MasterPageFile="~/CricketAdmin.master" AutoEventWireup="true"
    CodeFile="CustomerFancy.aspx.cs" Inherits="CustBetting" Debug="true" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <script src="js/jquery-1.10.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        var setReloadTime = setInterval("reloadPage()", 600000);
        function reloadPage() {
            location.reload();
        }
    </script>
    <script type="text/javascript" language="javascript">
        var whoseRate;
        $(document).ready(function () {

            $('#<%=txtSessionLagadiTeamA.ClientID %>').on('change', function () {
                $('#<%=txtSessionKhadhiTeamA.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamB.ClientID%>').val('');
                $('#<%=txtSessionKhadhiTeamB.ClientID%>').val('');
                $('#<%=txtSessionLagadiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamDraw.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamDraw.ClientID %>').val('');
            });

            $('#<%=txtSessionKhadhiTeamA.ClientID %>').on('change', function () {
                $('#<%=txtSessionLagadiTeamA.ClientID %>').val('')
                $('#<%=txtSessionLagadiTeamB.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamB.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamDraw.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamDraw.ClientID %>').val('');
            });

            $('#<%=txtSessionLagadiTeamB.ClientID %>').on('change', function () {
                $('#<%=txtSessionLagadiTeamA.ClientID %>').val('')
                $('#<%=txtSessionKhadhiTeamA.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamB.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamDraw.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamDraw.ClientID %>').val('');
            });

            $('#<%=txtSessionKhadhiTeamB.ClientID %>').on('change', function () {
                $('#<%=txtSessionLagadiTeamA.ClientID %>').val('')
                $('#<%=txtSessionKhadhiTeamA.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamB.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamDraw.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamDraw.ClientID %>').val('');
            });

            $('#<%=txtSessionLagadiTeamTie.ClientID %>').on('change', function () {
                $('#<%=txtSessionLagadiTeamA.ClientID %>').val('')
                $('#<%=txtSessionKhadhiTeamA.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamB.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamB.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamDraw.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamDraw.ClientID %>').val('');
            });

            $('#<%=txtSessionKhadhiTeamTie.ClientID %>').on('change', function () {
                $('#<%=txtSessionLagadiTeamA.ClientID %>').val('')
                $('#<%=txtSessionKhadhiTeamA.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamB.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamB.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamDraw.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamDraw.ClientID %>').val('');
            });

            $('#<%=txtSessionLagadiTeamDraw %>').on('change', function () {
                $('#<%=txtSessionLagadiTeamA.ClientID %>').val('')
                $('#<%=txtSessionKhadhiTeamA.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamB.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamB.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamDraw.ClientID %>').val('');
            });

            $('#<%=txtSessionKhadhiTeamDraw.ClientID %>').on('change', function () {
                $('#<%=txtSessionLagadiTeamA.ClientID %>').val('')
                $('#<%=txtSessionKhadhiTeamA.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamB.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamB.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionKhadhiTeamTie.ClientID %>').val('');
                $('#<%=txtSessionLagadiTeamDraw.ClientID %>').val('');

            });

        });
        window.onload = function () {
            //            document.getElementById("loading_image").style.display = "none";
            //            var opts = {
            //                lines: 14, // The number of lines to draw
            //                length: 7, // The length of each line
            //                width: 4, // The line thickness
            //                radius: 10, // The radius of the inner circle
            //                color: '#000', // #rgb or #rrggbb
            //                speed: 1, // Rounds per second
            //                trail: 60, // Afterglow percentage
            //                shadow: false // Whether to render a shadow
            //            };
            //            var target = document.getElementById('foo');
            //            var spinner = new Spinner(opts);
            //            var prm = Sys.WebForms.PageRequestManager.getInstance();
            //            prm.add_endRequest(panelLoaded);

            //            prm.add_beginRequest(panelUpdateRequest);
            //            function panelLoaded(sender, args) {
            //                spinner.stop();
            //            }
            //            function panelUpdateRequest(sender, args) {
            //                spinner.spin(target);
            //            }
        }
        $(window).bind('beforeunload', function () {

            //            document.getElementById("loading_image_gif").style.display = "";
            //            document.getElementById("loading_image").style.display = "";

        });
        function hideButton() {
            $('#<%=btnSubmit.ClientID %>').hide();
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <asp:HiddenField ID="hdnTeamAId" runat="server" />
    <asp:HiddenField ID="hdnTeamBId" runat="server" />
    <asp:HiddenField ID="hdnCustomerLimit" runat="server" />
    <div class="container-fluid">
        <h3 class="page-title">
            Betting<small></small>
        </h3>
        <div class="row-fluid">
            <div class="span12">
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption">
                            Betting</div>
                        <div class="actions">
                            <span id="spScore" style="font-weight: bold; font-size: x-large;"></span>
                        </div>
                    </div>
                    <div class="portlet-body form">
                        <asp:UpdateProgress ID="updateProgress" runat="server" AssociatedUpdatePanelID="updPanelBetting">
                            <ProgressTemplate>
                                <div class="modal-backdrop fade in" style="text-align: center; z-index: 11111111;"
                                    id="loading_image">
                                    <img id="loading_image_gif" style="width: 100px; margin-top: 25%; z-index: 111111111;"
                                        src="images/loading.gif">
                                </div>
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                        <asp:UpdatePanel ID="updPanelBetting" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <div class="alert alert-danger" id="layerError" runat="server" style="display: none;">
                                </div>
                                <div class="alert alert-success" id="layerSuccess" runat="server" style="display: none;">
                                </div>
                                <div class="form-horizontal form-view">
                                    <h3>
                                        <div class="row-fluid">
                                            <div class="span12">
                                                <div class="control-group">
                                                    <label class="control-label">
                                                        Betting Limit:
                                                    </label>
                                                    <div class="controls">
                                                        <asp:Label ID="spBettingLimit" runat="server"></asp:Label>
                                                    </div>
                                                    <label class="control-label">
                                                        Min Limit:
                                                    </label>
                                                    <div class="controls">
                                                        <asp:Label ID="Label2" runat="server"></asp:Label>
                                                    </div>
                                                    <label class="control-label">
                                                        Max Limit:
                                                    </label>
                                                    <div class="controls">
                                                        <asp:Label ID="Label3" runat="server"></asp:Label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </h3>
                                    <div class="row-fluid">
                                        <div class="span12">
                                            <div class="control-group">
                                                <label class="control-label">
                                                    Match Type <span class="required">*</span></label>
                                                <div class="controls">
                                                    <asp:HiddenField ID="hdnBettingId" runat="server" />
                                                    <asp:HiddenField ID="hdnAdminId" runat="server" />
                                                    <asp:HiddenField ID="hdnClientId" runat="server" />
                                                    <asp:DropDownList ID="drpMatchType" runat="server" OnSelectedIndexChanged="drpMatchType_SelectedIndexChanged"
                                                        AutoPostBack="true">
                                                    </asp:DropDownList>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter match type"
                                                        InitialValue="0" ValidationGroup="Betting" CssClass="required" ControlToValidate="drpMatchType"
                                                        Display="Dynamic"></asp:RequiredFieldValidator>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="span12">
                                            <div class="control-group">
                                                <label class="control-label">
                                                    Select Match<span class="required">*</span></label>
                                                <div class="controls">
                                                    <asp:DropDownList ID="drpMatch" runat="server" OnSelectedIndexChanged="drpMatch_SelectedIndexChanged"
                                                        AutoPostBack="true">
                                                    </asp:DropDownList>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Please enter match"
                                                        InitialValue="0" ValidationGroup="Betting" CssClass="required" ControlToValidate="drpMatch"
                                                        Display="Dynamic"></asp:RequiredFieldValidator>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="span12">
                                            <div class="control-group">
                                                <label class="control-label">
                                                    Betting Type<span class="required">*</span></label>
                                                <div class="controls">
                                                    <asp:DropDownList ID="drpBettingType" runat="server" OnSelectedIndexChanged="drpBettingType_SelectedIndexChanged"
                                                        AutoPostBack="true">
                                                    </asp:DropDownList>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="Please enter betting type"
                                                        InitialValue="0" ValidationGroup="Betting" CssClass="required" ControlToValidate="drpBettingType"
                                                        Display="Dynamic"></asp:RequiredFieldValidator>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid hide" id="div1" runat="server" style="display: block;">
                                        <div class="span12">
                                            <div class="control-group">
                                                <label class="control-label" id="Label1">
                                                </label>
                                                <div class="controls">
                                                    <div class="input-prepend hide" id="divOver" runat="server">
                                                        <span class="add-on" id="spOver">Over</span>
                                                    </div>
                                                    <div class="input-prepend hide" id="divLagadi" runat="server">
                                                        <span class="add-on" id="spLagadi" runat="server">Lagadi</span>
                                                    </div>
                                                    <div class="input-prepend hide" id="divKhadhi" runat="server">
                                                        <span class="add-on" id="spKhadhi" runat="server">Khadhi</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid hide" id="div2" runat="server" style="display: block;">
                                        <div class="span12">
                                            <div class="control-group">
                                                <label class="control-label" id="Label4">
                                                </label>
                                                <div class="controls">
                                                    <div class="input-prepend hide" id="divFNOver" runat="server">
                                                        <span class="add-on" id="spanFNOver">Over</span>
                                                    </div>
                                                    <div class="input-prepend hide" id="divFN90" runat="server">
                                                        <span class="add-on" id="span90" runat="server">90 L</span>
                                                    </div>
                                                    <div class="input-prepend hide" id="divFN110" runat="server">
                                                        <span class="add-on" id="span110" runat="server">110 K</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid hide" id="divBettingTeamA" runat="server">
                                        <div class="span12">
                                            <div class="control-group">
                                                <asp:Label ID="lblTeamA" runat="server" CssClass="TeamAName control-label"> </asp:Label>
                                                <asp:TextBox CssClass="control-label hide TeamABettingId" ID="TeamABettingId" runat="server">
                                                </asp:TextBox>
                                                <div class="controls">
                                                    <div class="input-prepend" id="divOverTeamA" runat="server">
                                                        <span class="add-on" id="lblSessionOverTeamA"></span>
                                                    </div>
                                                    <div class="input-prepend">
                                                        <asp:HiddenField ID="hdnTeamAL" runat="server" />
                                                        <span class="add-on" id="spSessionLagadiTeamA" runat="server"></span>
                                                        <asp:TextBox ID="txtSessionLagadiTeamA" type="number" CssClass="m-wrap span5 txtSessionLagadiTeamA"
                                                            runat="server"></asp:TextBox>
                                                    </div>
                                                    <div class="input-prepend">
                                                        <asp:HiddenField ID="hdnTeamAK" runat="server" />
                                                        <span class="add-on" id="spSessionKhadhiTeamA" runat="server"></span>
                                                        <asp:TextBox ID="txtSessionKhadhiTeamA" type="number" CssClass=" m-wrap span5 txtSessionKhadhiTeamA"
                                                            runat="server"></asp:TextBox>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid hide" id="divBettingTeamB" runat="server">
                                        <div class="span12">
                                            <div class="control-group">
                                                <asp:Label ID="lblTeamB" runat="server" CssClass="TeamBName control-label"></asp:Label>
                                                <asp:TextBox class="control-label hide TeamBBettingId" ID="TeamBBettingId" runat="server">
                                                </asp:TextBox>
                                                <div class="controls">
                                                    <div class="input-prepend" id="divOverTeamB" runat="server">
                                                        <span class="add-on" id="lblSessionOverTeamB"></span>
                                                    </div>
                                                    <div class="input-prepend">
                                                        <asp:HiddenField ID="hdnTeamBL" runat="server" />
                                                        <span class="add-on" id="spSessionLagadiTeamB" runat="server"></span>
                                                        <asp:TextBox ID="txtSessionLagadiTeamB" type="number" CssClass="m-wrap span5 txtSessionLagadiTeamB"
                                                            runat="server"></asp:TextBox>
                                                    </div>
                                                    <div class="input-prepend">
                                                        <asp:HiddenField ID="hdnTeamBK" runat="server" />
                                                        <span class="add-on" id="spSessionKhadhiTeamB" runat="server"></span>
                                                        <asp:TextBox ID="txtSessionKhadhiTeamB" type="number" CssClass=" m-wrap span5 txtSessionKhadhiTeamB"
                                                            runat="server"></asp:TextBox>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid hide" id="divBettingTie" runat="server">
                                        <div class="span12">
                                            <div class="control-group">
                                                <label class="control-label" id="TeamTie">
                                                </label>
                                                <asp:TextBox CssClass="control-label hide TeamTieBettingId" ID="TeamTieBettingId"
                                                    runat="server">
                                                </asp:TextBox>
                                                <div class="controls">
                                                    <div class="input-prepend" id="divOverTie" runat="server">
                                                        <span class="add-on" id="lblSessionOverTie"></span>
                                                    </div>
                                                    <div class="input-prepend">
                                                        <asp:HiddenField ID="hdnTieL" runat="server" />
                                                        <span class="add-on" id="spSessionLagadiTeamTie" runat="server"></span>
                                                        <asp:TextBox ID="txtSessionLagadiTeamTie" type="number" CssClass="m-wrap span5 txtSessionLagadiTeamTie"
                                                            runat="server"></asp:TextBox>
                                                    </div>
                                                    <div class="input-prepend">
                                                        <asp:HiddenField ID="hdnTieK" runat="server" />
                                                        <span class="add-on" id="spSessionKhadhiTeamTie" runat="server"></span>
                                                        <asp:TextBox ID="txtSessionKhadhiTeamTie" type="number" CssClass=" m-wrap span5 txtSessionKhadhiTeamTie"
                                                            runat="server"></asp:TextBox>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid hide" id="divBettingDraw" runat="server">
                                        <div class="span12">
                                            <div class="control-group">
                                                <label class="control-label" id="TeamDraw">
                                                </label>
                                                <asp:TextBox CssClass="control-label hide TeamDrawBettingId" ID="TeamDrawBettingId"
                                                    runat="server">
                                                </asp:TextBox>
                                                <div class="controls">
                                                    <div class="input-prepend" id="divOverDraw" runat="server">
                                                        <span class="add-on" id="lblSessionOverDraw"></span>
                                                    </div>
                                                    <div class="input-prepend">
                                                        <asp:HiddenField ID="hdnDrawL" runat="server" />
                                                        <span class="add-on" id="spSessionLagadiTeamDraw" runat="server"></span>
                                                        <asp:TextBox ID="txtSessionLagadiTeamDraw" type="number" CssClass="m-wrap span5 txtSessionLagadiTeamDraw"
                                                            runat="server"></asp:TextBox>
                                                    </div>
                                                    <div class="input-prepend">
                                                        <asp:HiddenField ID="hdnDrawK" runat="server" />
                                                        <span class="add-on" id="spSessionKhadhiTeamDraw" runat="server"></span>
                                                        <asp:TextBox ID="txtSessionKhadhiTeamDraw" type="number" CssClass=" m-wrap span5 txtSessionKhadhiTeamDraw"
                                                            runat="server"></asp:TextBox>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid hide" id="divFancyNineEleven" runat="server">
                                        <div class="span12">
                                            <div class="control-group">
                                                <asp:Label ID="lblTeamFancy" runat="server" CssClass="TeamFancy control-label"> </asp:Label>
                                                <asp:TextBox CssClass="control-label hide TeamFancyBettingId" ID="TeamFancyBettingId"
                                                    runat="server">
                                                </asp:TextBox>
                                                <asp:TextBox CssClass="control-label hide TeamFancyNineEleven" ID="TeamFancyNineEleven"
                                                    runat="server">
                                                </asp:TextBox>
                                                <div class="controls">
                                                    <div class="input-prepend" id="divFancyNineElevenOver" runat="server">
                                                        <span class="add-on" id="lblFancyNineElevenOver"></span>
                                                    </div>
                                                    <div class="input-prepend">
                                                        <asp:HiddenField ID="HiddenField1" runat="server" />
                                                        <span class="add-on" id="hdnFNL" runat="server"></span>
                                                        <asp:TextBox ID="txtFancyNELagadi" type="number" CssClass="m-wrap span5 txtFancyNELagadi"
                                                            runat="server"></asp:TextBox>
                                                    </div>
                                                    <div class="input-prepend">
                                                        <asp:HiddenField ID="HiddenField2" runat="server" />
                                                        <span class="add-on" id="hdnFNK" runat="server"></span>
                                                        <asp:TextBox ID="txtFancyNEKhadhi" type="number" CssClass=" m-wrap span5 txtFancyNEKhadhi"
                                                            runat="server"></asp:TextBox>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid hide" id="divFancyNineEleven1" runat="server">
                                        <div class="span12">
                                            <div class="control-group">
                                                <asp:Label ID="lblTeamFancy1" runat="server" CssClass="TeamFancy1 control-label"> </asp:Label>
                                                <asp:TextBox CssClass="control-label hide TeamFancyBettingId" ID="TeamFancyBettingId1"
                                                    runat="server">
                                                </asp:TextBox>
                                                <asp:TextBox CssClass="control-label hide TeamFancyNineEleven" ID="TeamFancyNineEleven1"
                                                    runat="server">
                                                </asp:TextBox>
                                                <div class="controls">
                                                    <div class="input-prepend" id="divFancyNineElevenOver1" runat="server">
                                                        <span class="add-on" id="lblFancyNineElevenOver1"></span>
                                                    </div>
                                                    <div class="input-prepend">
                                                        <asp:HiddenField ID="HiddenField3" runat="server" />
                                                        <span class="add-on" id="hdnFNL1" runat="server"></span>
                                                        <asp:TextBox ID="txtFancyNELagadi1" type="number" CssClass="m-wrap span5 txtFancyNELagadi1"
                                                            runat="server"></asp:TextBox>
                                                    </div>
                                                    <div class="input-prepend">
                                                        <asp:HiddenField ID="HiddenField4" runat="server" />
                                                        <span class="add-on" id="hdnFNK1" runat="server"></span>
                                                        <asp:TextBox ID="txtFancyNEKhadhi1" type="number" CssClass=" m-wrap span5 txtFancyNEKhadhi1"
                                                            runat="server"></asp:TextBox>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="span6">
                                            <div class="control-group" id="errorLagadi">
                                                <label class="control-label">
                                                </label>
                                                <div class="controls">
                                                    <asp:Button ID="btnSubmit" runat="server" Text="Submit" UseSubmitBehavior="true"
                                                        OnClientClick="hideButton()" OnClick="btnSubmit_Click" CssClass="btn blue btnSubmit" />
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row-fluid">
                                    <div class="span6">
                                        <asp:GridView ID="grdCustomerBettingMatch" runat="server" AutoGenerateColumns="False"
                                            CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%" OnRowDataBound="grdCustomerBettingMatch_RowDataBound">
                                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                            <Columns>
                                                <%--<asp:BoundField DataField="Abbrivation" HeaderText="Team Name" HeaderStyle-HorizontalAlign="Left" />
                                        <asp:BoundField DataField="Rate" HeaderText="Rate" HeaderStyle-HorizontalAlign="Left" />
                                        <asp:BoundField DataField="BettingFor" HeaderText="K/L" HeaderStyle-HorizontalAlign="Left" />--%>
                                                <asp:BoundField DataField="BettingAmount" HeaderText="Betting Amount" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="TeamAAmount" HeaderText="TeamA Amount" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="TeamBAmount" HeaderText="TeamB Amount" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="DrawAmount" HeaderText="Draw Amount" HeaderStyle-HorizontalAlign="Left" />
                                            </Columns>
                                            <EditRowStyle BackColor="#999999" />
                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                            <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                            <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                            <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                        </asp:GridView>
                                    </div>
                                    <div class="span6">
                                        <asp:Label ID="lblSTeamAAmount" runat="server"></asp:Label>
                                        <asp:Label ID="lblSTeamBAmount" runat="server"></asp:Label>
                                        <asp:Label ID="lblSDrawAmount" runat="server"></asp:Label>
                                        <asp:GridView ID="grdCustomerBettingSession" runat="server" AutoGenerateColumns="False"
                                            CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%">
                                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                            <Columns>
                                                <asp:BoundField DataField="Abbrivation" HeaderText="Team Name" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="Over" HeaderText="Over" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="Rate" HeaderText="Run" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="BettingFor" HeaderText="K/L" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="BettingAmount" HeaderText="Betting Amount" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="Date" HeaderText="Date" HeaderStyle-HorizontalAlign="Left" />
                                                <%--<asp:BoundField DataField="BettingTotal" HeaderText="Total" HeaderStyle-HorizontalAlign="Left" />--%>
                                            </Columns>
                                            <EditRowStyle BackColor="#999999" />
                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                            <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                            <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                            <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                        </asp:GridView>
                                    </div>
                                </div>
                                <div class="row-fluid">
                                    
                                    <div class="span6">
                                        <asp:GridView ID="grndFancy911" runat="server" AutoGenerateColumns="False" CellPadding="4"
                                            ForeColor="#333333" GridLines="None" Width="100%">
                                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                            <Columns>
                                                <asp:BoundField DataField="Abbrivation" HeaderText="Team Name" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="Over" HeaderText="Over" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="BettingRate" HeaderText="Run" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="BetFor" HeaderText="K/L" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="BettingAmount" HeaderText="Chips" HeaderStyle-HorizontalAlign="Left" />
                                                <asp:BoundField DataField="Date" HeaderText="90/110  Date" HeaderStyle-HorizontalAlign="Left" />
                                                <%--<asp:BoundField DataField="BettingTotal" HeaderText="Total" HeaderStyle-HorizontalAlign="Left" />--%>
                                            </Columns>
                                            <EditRowStyle BackColor="#999999" />
                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                            <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                            <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                            <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                        </asp:GridView>
                                    </div>
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">

        $(".txtSessionLagadi").on("focus", function () {
            $(".txtSessionKhadhi").val('');
        });

        $(".txtSessionKhadhi").on("focus", function () {
            $(".txtSessionLagadi").val('');
        });


        function getScore() {
            var matchId = $('#<%=drpMatch.ClientID %> option:selected').val();
            if (matchId != undefined && matchId != "0") {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",

                    data: "{'matchId': " + matchId + "}",
                    url: "Betting.aspx/GetScore",
                    dataType: "json",
                    async: false,
                    success: function (data) {
                        var results = data.d;
                        if (results != null) {
                            //html(results[i].KhadhiRate)<span id="spScore" style="font-weight: bold; font-size: x-large;">IND (10 - 101/2)</span>
                            $("#spScore").html(results[0].TeamName + '' + '(' + results[0].Over + ' ' + 'Ov' + ' - ' + results[0].Run + ')')
                        }
                    },
                    error: function (response) {
                        //alert('e');
                    }
                });
            }

        }
        function getCommonRate() {
            var adminId = $('#<%=hdnAdminId.ClientID %>').val();
            if (adminId != undefined && adminId != "0") {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",

                    data: "{'adminId': " + adminId + "}",
                    url: "Betting.aspx/getCurrentRate",
                    dataType: "json",
                    async: false,
                    success: function (data) {
                        var results = data.d;
                        if (results != null) {
                            whoseRate = results[0].CommonRate;

                        }
                    },
                    error: function (response) {
                        //alert('e');
                    }
                });
            }
        }
        function getRecordsForSession() {
            $("#div1").show();
            var adminId;
            getCommonRate();
            if (whoseRate == 2) {
                adminId = 3;
            }
            else {
                adminId = $('#<%=hdnAdminId.ClientID %>').val();
            }

            var matchId = $('#<%=drpMatch.ClientID %> option:selected').val();
            var bettingType = $('#<%=drpBettingType.ClientID %> option:selected').val();

            if (bettingType != undefined && bettingType != "0") {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",

                    data: "{'adminId': " + adminId + ",'matchId':" + matchId + ", 'bettingType':" + bettingType + "}",
                    url: "Betting.aspx/GetBettingSessionRecords",
                    dataType: "json",
                    async: false,
                    success: function (data) {
                        var results = data.d;

                        if (results != null) {

                            $('#<%=txtSessionLagadiTeamA.ClientID %>').prop('disabled', true);
                            $('#<%=txtSessionKhadhiTeamA.ClientID %>').prop('disabled', true);
                            $('#<%=txtSessionLagadiTeamB.ClientID %>').prop('disabled', true);
                            $('#<%=txtSessionKhadhiTeamB.ClientID %>').prop('disabled', true);
                            $('#<%=txtSessionLagadiTeamTie.ClientID %>').prop('disabled', true);
                            $('#<%=txtSessionKhadhiTeamTie.ClientID %>').prop('disabled', true);
                            $('#<%=txtSessionLagadiTeamDraw.ClientID %>').prop('disabled', true);
                            $('#<%=txtSessionKhadhiTeamDraw.ClientID %>').prop('disabled', true);
                            $('#<%=btnSubmit.ClientID %>').hide();


                            for (var i = 0; i < results.length; i++) {
                                $("#TeamTie").text('Tie');
                                $("#TeamDraw").text('Draw');

                                //Team 1
                                if (results[i].TeamName == $(".TeamAName").text()) {
                                    $(".TeamABettingId").val(results[i].Id);
                                    $("#lblSessionOverTeamA").html(results[i].Over);
                                    if (bettingType == "1") {
                                        $("#<%=spSessionLagadiTeamA.ClientID %>").html(results[i].KhadhiRate);
                                        $("#<%=spSessionKhadhiTeamA.ClientID %>").html(results[i].LagadiRate);
                                    }
                                    else {
                                        $("#<%=spSessionLagadiTeamA.ClientID %>").html(results[i].LagadiRate);
                                        $("#<%=spSessionKhadhiTeamA.ClientID %>").html(results[i].KhadhiRate);
                                    }
                                    $("#<%=hdnTeamAL.ClientID %>").val(results[i].LagadiRate);
                                    $("#<%=hdnTeamAK.ClientID %>").val(results[i].KhadhiRate);
                                    if (results[i].BettingOnOff == 'Off') {
                                        $("#<%=spSessionLagadiTeamA.ClientID %>").css("background-color", "#e5e5e5");
                                        $("#<%=spSessionLagadiTeamA.ClientID %>").css("color", "#000");
                                        $("#<%=spSessionKhadhiTeamA.ClientID %>").css("background-color", "#e5e5e5");
                                        $("#<%=spSessionKhadhiTeamA.ClientID %>").css("color", "#000");


                                        $('#<%=txtSessionLagadiTeamA.ClientID %>').val('');
                                        $('#<%=txtSessionKhadhiTeamA.ClientID %>').val('');

                                        $('#<%=txtSessionLagadiTeamA.ClientID %>').prop('disabled', true);
                                        $('#<%=txtSessionKhadhiTeamA.ClientID %>').prop('disabled', true);
                                    }
                                    else {
                                        $("#<%=spSessionLagadiTeamA.ClientID %>").css("background-color", "#4B8BF8");
                                        $("#<%=spSessionLagadiTeamA.ClientID %>").css("color", "#FFFFFF");
                                        $("#<%=spSessionKhadhiTeamA.ClientID %>").css("background-color", "#4B8BF8");
                                        $("#<%=spSessionKhadhiTeamA.ClientID %>").css("color", "#FFFFFF");

                                        $('#<%=txtSessionLagadiTeamA.ClientID %>').prop('disabled', false);
                                        $('#<%=txtSessionKhadhiTeamA.ClientID %>').prop('disabled', false);

                                        $('#<%=btnSubmit.ClientID %>').show();
                                    }
                                }

                                //Team 2
                                if (results[i].TeamName == $(".TeamBName").text()) {
                                    $(".TeamBBettingId").val(results[i].Id);
                                    $("#lblSessionOverTeamB").html(results[i].Over);
                                    if (bettingType == "1") {
                                        $("#<%=spSessionLagadiTeamB.ClientID %>").html(results[i].KhadhiRate);
                                        $("#<%=spSessionKhadhiTeamB.ClientID %>").html(results[i].LagadiRate);
                                    }
                                    else {
                                        $("#<%=spSessionLagadiTeamB.ClientID %>").html(results[i].LagadiRate);
                                        $("#<%=spSessionKhadhiTeamB.ClientID %>").html(results[i].KhadhiRate);
                                    }

                                    $("#<%=hdnTeamBL.ClientID %>").val(results[i].LagadiRate);
                                    $("#<%=hdnTeamBK.ClientID %>").val(results[i].KhadhiRate);
                                    if (results[i].BettingOnOff == 'Off') {
                                        $("#<%=spSessionLagadiTeamB.ClientID %>").css("background-color", "#e5e5e5");
                                        $("#<%=spSessionLagadiTeamB.ClientID %>").css("color", "#000");
                                        $("#<%=spSessionKhadhiTeamB.ClientID %>").css("background-color", "#e5e5e5");
                                        $("#<%=spSessionKhadhiTeamB.ClientID %>").css("color", "#000");

                                        $('#<%=txtSessionLagadiTeamB.ClientID %>').val('');
                                        $('#<%=txtSessionKhadhiTeamB.ClientID %>').val('');

                                        $('#<%=txtSessionLagadiTeamB.ClientID %>').prop('disabled', true);
                                        $('#<%=txtSessionKhadhiTeamB.ClientID %>').prop('disabled', true);
                                    }
                                    else {
                                        $("#<%=spSessionLagadiTeamB.ClientID %>").css("background-color", "#4B8BF8");
                                        $("#<%=spSessionLagadiTeamB.ClientID %>").css("color", "#FFFFFF");
                                        $("#<%=spSessionKhadhiTeamB.ClientID %>").css("background-color", "#4B8BF8");
                                        $("#<%=spSessionKhadhiTeamB.ClientID %>").css("color", "#FFFFFF");

                                        $('#<%=txtSessionLagadiTeamB.ClientID %>').prop('disabled', false);
                                        $('#<%=txtSessionKhadhiTeamB.ClientID %>').prop('disabled', false);

                                        $('#<%=btnSubmit.ClientID %>').show();
                                    }
                                }

                                //Team Tie
                                if (results[i].TeamName == $("#TeamTie").text()) {
                                    $(".TeamTieBettingId").val(results[i].Id);
                                    $("#lblSessionOverTie").html(results[i].Over);
                                    $("#<%=spSessionLagadiTeamTie.ClientID %>").html(results[i].LagadiRate);
                                    $("#<%=spSessionKhadhiTeamTie.ClientID %>").html(results[i].KhadhiRate);
                                    $("#<%=hdnTieL.ClientID %>").val(results[i].LagadiRate);
                                    $("#<%=hdnTieK.ClientID %>").val(results[i].KhadhiRate);
                                    if (results[i].BettingOnOff == 'Off') {
                                        $("#<%=spSessionLagadiTeamTie.ClientID %>").css("background-color", "#e5e5e5");
                                        $("#<%=spSessionLagadiTeamTie.ClientID %>").css("color", "#000");
                                        $("#<%=spSessionKhadhiTeamTie.ClientID %>").css("background-color", "#e5e5e5");
                                        $("#<%=spSessionKhadhiTeamTie.ClientID %>").css("color", "#000");

                                        $('#<%=txtSessionLagadiTeamTie.ClientID %>').val('');
                                        $('#<%=txtSessionKhadhiTeamTie.ClientID %>').val('');

                                        $('#<%=txtSessionLagadiTeamTie.ClientID %>').prop('disabled', true);
                                        $('#<%=txtSessionKhadhiTeamTie.ClientID %>').prop('disabled', true);
                                    }
                                    else {
                                        $("#<%=spSessionLagadiTeamTie.ClientID %>").css("background-color", "#4B8BF8");
                                        $("#<%=spSessionLagadiTeamTie.ClientID %>").css("color", "#FFFFFF");
                                        $("#<%=spSessionKhadhiTeamTie.ClientID %>").css("background-color", "#4B8BF8");
                                        $("#<%=spSessionKhadhiTeamTie.ClientID %>").css("color", "#FFFFFF");

                                        $('#<%=txtSessionLagadiTeamTie.ClientID %>').prop('disabled', false);
                                        $('#<%=txtSessionKhadhiTeamTie.ClientID %>').prop('disabled', false);

                                        $('#<%=btnSubmit.ClientID %>').show();
                                    }
                                }

                                //Team Draw
                                if (results[i].TeamName == $("#TeamDraw").text()) {
                                    $(".TeamDrawBettingId").val(results[i].Id);
                                    $("#lblSessionOverDraw").html(results[i].Over);
                                    $("#<%=spSessionLagadiTeamDraw.ClientID %>").html(results[i].LagadiRate);
                                    $("#<%=spSessionKhadhiTeamDraw.ClientID %>").html(results[i].KhadhiRate);
                                    $("#<%=hdnDrawL.ClientID %>").val(results[i].LagadiRate);
                                    $("#<%=hdnDrawK.ClientID %>").val(results[i].KhadhiRate);
                                    if (results[i].BettingOnOff == 'Off') {

                                        $("#<%=spSessionLagadiTeamDraw.ClientID %>").css("background-color", "#e5e5e5");
                                        $("#<%=spSessionLagadiTeamDraw.ClientID %>").css("color", "#000");
                                        $("#<%=spSessionKhadhiTeamDraw.ClientID %>").css("background-color", "#e5e5e5");
                                        $("#<%=spSessionKhadhiTeamDraw.ClientID %>").css("color", "#000");

                                        $('#<%=txtSessionLagadiTeamDraw.ClientID %>').val('');
                                        $('#<%=txtSessionKhadhiTeamDraw.ClientID %>').val('');

                                        $('#<%=txtSessionLagadiTeamDraw.ClientID %>').prop('disabled', true);
                                        $('#<%=txtSessionKhadhiTeamDraw.ClientID %>').prop('disabled', true);
                                    }
                                    else {
                                        $("#<%=spSessionLagadiTeamDraw.ClientID %>").css("background-color", "#4B8BF8");
                                        $("#<%=spSessionLagadiTeamDraw.ClientID %>").css("color", "#FFFFFF");
                                        $("#<%=spSessionKhadhiTeamDraw.ClientID %>").css("background-color", "#4B8BF8");
                                        $("#<%=spSessionKhadhiTeamDraw.ClientID %>").css("color", "#FFFFFF");
                                        $('#<%=txtSessionLagadiTeamDraw.ClientID %>').prop('disabled', false);
                                        $('#<%=txtSessionKhadhiTeamDraw.ClientID %>').prop('disabled', false);
                                        $('#<%=btnSubmit.ClientID %>').show();
                                    }
                                }
                            }
                        }
                    },
                    error: function (response) {
                        //alert('e');
                    }
                });
            }
        }

        function getRecordForNineEleven() {
            $("#div2").show();
            var adminId;
            getCommonRate();
            if (whoseRate == 2) {
                adminId = 3;
            }
            else {
                adminId = $('#<%=hdnAdminId.ClientID %>').val();
            }

            var matchId = $('#<%=drpMatch.ClientID %> option:selected').val();
            var bettingType = $('#<%=drpBettingType.ClientID %> option:selected').val();

            if (bettingType != undefined && bettingType != "0") {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",

                    data: "{'adminId': " + adminId + ",'matchId':" + matchId + ", 'bettingType':" + bettingType + "}",
                    url: "CustomerFancy.aspx/GetBettingFancyRecords",
                    dataType: "json",
                    async: false,
                    success: function (data) {

                        var results = data.d;

                        if (results != null) {

                            $('#<%=txtFancyNELagadi.ClientID %>').prop('disabled', true);
                            $('#<%=txtFancyNEKhadhi.ClientID %>').prop('disabled', true);

                            $('#<%=btnSubmit.ClientID %>').hide();


                            for (var i = 0; i < results.length; i++) {


                                //Team 1
                                if (results[i].TeamName == $(".TeamFancy").text()) {
                                    $(".TeamFancyBettingId").val(results[i].Id);
                                    $("#lblFancyNineElevenOver").html(results[i].Over);

                                    $("#<%=hdnFNL.ClientID %>").html(results[i].BettingRate);
                                    $("#<%=HiddenField1.ClientID %>").val(results[i].BettingRate);

                                    if (results[i].BettingOnOff == 'Off') {
                                        $("#<%=hdnFNL.ClientID %>").css("background-color", "#e5e5e5");
                                        $("#<%=hdnFNL.ClientID %>").css("color", "#000");

                                        $('#<%=txtFancyNELagadi.ClientID %>').val('');
                                        $('#<%=txtFancyNEKhadhi.ClientID %>').val('');

                                        $('#<%=txtFancyNELagadi.ClientID %>').prop('disabled', true);
                                        $('#<%=txtFancyNEKhadhi.ClientID %>').prop('disabled', true);
                                    }
                                    else {
                                        $("#<%=hdnFNL.ClientID %>").css("background-color", "#4B8BF8");
                                        $("#<%=hdnFNL.ClientID %>").css("color", "#FFFFFF");


                                        $('#<%=txtFancyNELagadi.ClientID %>').prop('disabled', false);
                                        $('#<%=txtFancyNEKhadhi.ClientID %>').prop('disabled', false);

                                        $('#<%=btnSubmit.ClientID %>').show();
                                    }
                                }

                                //Team 2
                                if (results[i].TeamName == $(".TeamFancy1").text()) {
                                    $(".TeamFancyBettingId1").val(results[i].Id);
                                    $("#lblFancyNineElevenOver1").html(results[i].Over);

                                    $("#<%=hdnFNL1.ClientID %>").html(results[i].BettingRate);
                                    $("#<%=HiddenField3.ClientID %>").val(results[i].BettingRate);

                                    if (results[i].BettingOnOff == 'Off') {
                                        $("#<%=hdnFNL1.ClientID %>").css("background-color", "#e5e5e5");
                                        $("#<%=hdnFNL1.ClientID %>").css("color", "#000");

                                        $('#<%=txtFancyNELagadi1.ClientID %>').val('');
                                        $('#<%=txtFancyNEKhadhi1.ClientID %>').val('');

                                        $('#<%=txtFancyNELagadi1.ClientID %>').prop('disabled', true);
                                        $('#<%=txtFancyNEKhadhi1.ClientID %>').prop('disabled', true);
                                    }
                                    else {
                                        $("#<%=hdnFNL1.ClientID %>").css("background-color", "#4B8BF8");
                                        $("#<%=hdnFNL1.ClientID %>").css("color", "#FFFFFF");


                                        $('#<%=txtFancyNELagadi1.ClientID %>').prop('disabled', false);
                                        $('#<%=txtFancyNEKhadhi1.ClientID %>').prop('disabled', false);

                                        $('#<%=btnSubmit.ClientID %>').show();
                                    }
                                }

                            }
                        }
                    },
                    error: function (response) {
                        //alert('e');
                    }
                });
            }
        }

        window.setInterval(function () {
            getRecordsForSession();
            getRecordForNineEleven();
            getScore();

        }, 2000);

        window.setInterval(function () {
            $(".alert-danger").hide();
            $(".alert-danger").html('');
            $(".alert-success").hide();
            $(".alert-danger").html('');
        }, 20000);

    </script>
</asp:Content>
